Open
Conversation
NyxCode
approved these changes
Feb 2, 2026
Collaborator
NyxCode
left a comment
There was a problem hiding this comment.
Code-wise this looks good to me. Fixing a bug while simplifying the code is just great.
If you'd like me to review the semantics of this change, then I'll need to put aside some time to look into this more. It's been a while since I worked on that part of the code.
However, if you're confident, you can also merge this as-is for a patch release. Your call!
Collaborator
Author
|
Hey @NyxCode, sorry I took a while to respond.
While I think this shouldn't break anything, I do think it's worth having you take a look just to make sure :D
Nah, I'm never confident in my own code lmao |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Allow the use of
#[ts(flatten)]with unit structsstruct Foo;and empty structsstruct Foo {}but not empty tuple structsstruct Foo(). This matches the behavior of#[serde(flatten)]The use of the type
{ }when flattening these structs does not cause the{}type to appear in typescript because of our.replace(" } & { ")which we added back when we first changed the implementation offlattento use type intersections, which means these structs simply disappear from the ts type as though#[ts(skip)]was used instead, which also matches serde behavior.Allowing
flattenonstruct Foo;(no curly braces) broke the generation of internally tagged enums because it caused an interaction with thestructversion of#[ts(tag = "...")], but this ended up making the enum generation code simpler as it removed an unnecessarymatchexpression and the need to manually add the internal tag, as thestructversion of this attribute does it insteadAlso added a validation rule to prevent the use of internal tagging (
#[ts(tag = "...")]without#[ts(content = "...")]) when the enum contains tuple variants,Closes #473
Changes
How did you go about solving the problem?
Checklist